#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:robot
@file: tpf_custom_node.py 
@version:
@time: 2022/05/25 
"""
from TapClientCore.T05_TM_feature.v2.TMF09_custom_node.tmf_custom_node import TMFCustomNode
from TapUtil.logfunc.logger import logger


class TPFCustomNode(TMFCustomNode):

    # 创建自定义节点，获取customId
    def create_custom_node_and_get_info(self, payload=None):
        response = self.create_custom_node(payload)
        custom_id = response.get('id')
        name = response.get('name')
        return {
            'name': name,
            'customId': custom_id
        }

    # 修改
    def update_custom_node_and_get_info(self, name, payload):
        response = self.patch_custom_node_by_name(name, payload)
        custom_id = response.get('id')
        name = response.get('name')
        return {
            'name': name,
            'customId': custom_id
        }


if __name__ == '__main__':
    T = TPFCustomNode()
    T.delete_custom_node_by_name('robot_mobile')
    print(T.create_custom_node_and_get_info({'name': 'robot_mobile'}))
